package com.example.travel_front.Activity;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager2.widget.ViewPager2;

import com.example.travel_front.Adapter.ImagePagerAdapter;
import com.example.travel_front.R;

public class NewsDetailActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.news_detail);
        // 获取传递的数据
        if (getIntent().hasExtra("key")) {
            String data = getIntent().getStringExtra("key");
            // 使用数据进行操作，比如更新UI
        }
        ViewPager2 viewPager = findViewById(R.id.image_event);
        int[] images = new int[]{R.drawable.news, R.drawable.news, R.drawable.news};
        // 使用当前 Fragment 或 Activity 作为构造参数
        ImagePagerAdapter adapter = new ImagePagerAdapter(this, images);
        viewPager.setAdapter(adapter);

    }
}
